import { createAxios } from './request-wrapper'

const baseUrl = window.APIURL+'/multipleuavpatrol'

// const baseUrl = 'http://192.168.26.157:8239'



const request = createAxios()

//获取类型
export const findallype = (data:any) => {
   return request({
    url:`${baseUrl}/moudle/resource/dict/findall`,
    method:'post',
    data,
   })
}

//获取table
export const getUavTaskPageList = (data:any) => {
  return request({
   url:`${baseUrl}/moudle/interfaceDock/getUavTaskPageList`,
   method:'post',
   data
  })
}

//获取任务状态
export const taskStatusStat = (params:any) => {
  return request({
   url:`${baseUrl}/moudle/task/taskinfo/taskStatusStat`,
   method:'get',
   params
  })
}

//删除table中的数据
export const delTaskByIds = (data:string[]) => {
  return request({
   url:`${baseUrl}/moudle/task/taskinfo/delTaskByIds`,
   method:'post',
   data
  })
}



//获取所属行业
export const industryBelong = (data:any) => {
  return request({
    url:`${baseUrl}/moudle/resource/industry/findall`,
    method: "post",
    data
  });
};

//获取历史主题
export const gethistorysubject = (params:any) => {
  return request({
    url:`${baseUrl}/moudle/task/taskinfo/gethistorysubject`,
    method: "get",
    params
  });
};


//获取任务类型
export const taskType = (data:any) => {
  return request({
    url:`${baseUrl}/moudle/resource/dict/findall`,
    method: "post",
    data
  });
};

//获取行政区县
export const areaRegion = (data:any) => {
  return request({
    url:`${baseUrl}/moudle/resource/systemRegion/findall`,
    method: "post",
    data
  });
};



//上传测区文件
export const uploadFIleSurveyedArea = (data:any) =>{
  return request({
    url:`${baseUrl}/moudle/task/taskinfo/uploadFIleSurveyedArea`,
    method: "post",
    data
  })
}


/*
*数据采集
*
*
*/

//新增任务
export const createTaskInfo = (data:any) =>{
  return request({
    url:`${baseUrl}/moudle/task/taskinfo/createTaskInfo`,
    method: "post",
    data
  })
}

//编辑任务
export const editTaskInfo = (data:any) =>{
  return request({
    url:`${baseUrl}/moudle/task/taskinfo/editTaskInfo`,
    method: "post",
    data
  })
}


//通过id获取编制方案
export const getTaskPlanBYTaskId = (params:any) => {
  return request({
    url:`${baseUrl}/moudle/task/taskPlan/getTaskPlanBYTaskId`,
    method: "get",
    params
  });
};

//获取测区名称new
export const getSurveyExecCount = (params:any) => {
  return request({
    url:`${baseUrl}/moudle/task/surveyInfo/getSurveyExecCount`,
    method: "get",
    params
  });
};

//获取飞手信息
export const getFlyer = (data:any) => {
  return request({
    url: `${baseUrl}/moudle/userinfo/human/findall`,
    method: "post",
    data
  });
};


//获取无人机编码
export const getDeviceUav = (data:any) => {
  return request({
    url: `${baseUrl}/moudle/resource/deviceUav/findall`,
    method: "post",
    data
  });
};

//保存编制方案
export const saveTaskPlans = (data:any) => {
  return request({
    url: `${baseUrl}/moudle/task/taskPlan/saveTaskPlans`,
    method: "post",
    data
  });
};

//新增一个编制方案
export const newTaskPlan = (params:any) => {
  return request({
    url: `${baseUrl}/moudle/task/taskPlan/newTaskPlan`,
    method: "get",
    params
  });
};

//删除执行方案
export const delTaskPlans = (params:any) => {
  return request({
    url: `${baseUrl}/moudle/task/taskPlan/delTaskPlans`,
    method: "get",
    params
  });
};

//结束方案
export const overTaskPlan = (params:any) => {
  return request({
    url:`${baseUrl}/moudle/task/taskPlan/overTaskPlan`,
    method: "get",
    params
  });
};


//获取规定时间内的无人机设备
export const getNoConflictUav = (data:any) => {
  return request({
    url: `${baseUrl}/moudle/task/taskinfo/getNoConflictUav`,
    method: "post",
    data
  });
};


//查看对应的上传结果
export const getPlansResult = (params:any) => {
  return request({
    url: `${baseUrl}/moudle/task/taskPlan/getPlansResult`,
    method: "get",
    params
  });
};


//上传内容
export const uploadFIle = (data:any) => {
  return request({
    url: `${baseUrl}/moudle/task/taskinfo/uploadFIle`,
    method: "post",
    data
  });
};

//保存上传内容
export const saveTaskAchievement = (data:any) => {
  return request({
    url: `${baseUrl}/moudle/task/taskAchievement/saveTaskAchievement`,
    method: "post",
    data,
  });
};

//检查设备
export const checkUavStatus = (params:any) => {
  return request({
    url: `${baseUrl}/moudle/check/checkUavStatus`,
    method: "get",
    params,
  });
};


//根据无人机id获取无人机对应 飞行记录
export const getflypathsbyuavid = (params:any) => {
  return request({
    url: `${baseUrl}/moudle/task/taskUavFly/getflypathsbyuavid`,
    method: "get",
    params,
  });
};

//根据无人机id获取此 结果分析列表 
export const getFlyPathAnalysisResult = (params:any) => {
  return request({
    url: `${baseUrl}/moudle/uavtrailanalysis/getFlyPathAnalysisResult`,
    method: "get",
    params,
  });
};

//删除一个分析结果
export const deleteAnalysisResult = (id:string) => {
  return request({
    url: `${baseUrl}/moudle/uavtrailanalysis/delete/${id}`,
    method: "get"
  });
};


//轨迹分析保存
export const uavTrailAnalysisSave = (data:any) => {
  return request({
    url: `${baseUrl}/moudle/uavtrailanalysis/uavTrailAnalysisSave`,
    method: "post",
    data,
  });
};

//添加异常信息
export const addUavAlarm = (params:any) => {
  return request({
    url: `${baseUrl}/moudle/task/taskUav/addUavAlarm`,
    method: "get",
    params
  });
};
